package com.lsu.state.experiment;


/**
 * 环境类
 *
 * @Author wang suo
 * @Date 2020/12/26 0026 15:07
 * @Version 1.0
 */
public class Context {
    /**
     * 定义出所有的状态
     */
    public final static NoCoinState NO_COIN_STATE = new NoCoinState();
    public final static HalfCoinState HALF_COIN_STATE = new HalfCoinState();
    public final static OneCoinState ONE_COIN_STATE = new OneCoinState();

    private BaseState baseState;

    public BaseState getBaseState() {
        return baseState;
    }

    public void setBaseState(BaseState baseState) {
        this.baseState = baseState;
        baseState.setContext(this);
    }

    void insertHalfCoin() {
        this.baseState.insertHalfCoin();
    }

    void insertOneCoin() {
        this.baseState.insertOneCoin();
    }
}
